package com.jobsys.job;

import org.apache.log4j.Logger;
import org.quartz.JobExecutionContext;

import com.jobsys.pageprocesser.ZhiLianPage;
import com.jobsys.utils.SpiderThreadPool;

import us.codecraft.webmagic.Spider;

/**
 * 亚马逊
 * 
 * @author
 *
 */
public class ZhiLianJob extends AbsJob {
	private Logger logger = Logger.getLogger(ZhiLianJob.class);

	@Override
	protected void process(JobExecutionContext context) {
		logger.info("爬取智联招聘...");
		// post请求
		// NameValuePair[] values = new NameValuePair[2];
		// values[0] = new BasicNameValuePair("client_url", vs.getClient_url());
		// values[1] = new BasicNameValuePair("session_token",
		// vs.getSession_token());
		//
		// Map nameValuePair = new HashMap();
		// nameValuePair.put("nameValuePair", values);
		//
		// Request request = new Request(vs.getShowMoreURL());
		// request.setExtras(nameValuePair);
		// request.setMethod(HttpConstant.Method.POST);
		//
		// Spider.create(spider).thread(5).addRequest(request).run();
		String url = "http://www.highpin.cn/zhiwei/rd_1.html";
		Spider spider = Spider.create(new ZhiLianPage()).addUrl(url);
		// 加入线程池管理
		SpiderThreadPool.add(this.getClass().getName(), spider);
		spider.run();
	}
}
